<%@page import="systems.ConfigSystem"%>
<%@page import="entities.SiteConfig"%>
<%@page import="helpers.StringHelper"%>
<%@page import="java.util.TreeMap"%>
<%@page import="entities.MetaSeo"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="entities.AuthorQuestion"%>
<%@page import="java.util.Map"%>
<%@page import="entities.Author"%>
<%@page import="java.util.List"%>
<%@page import="helpers.PaginatorHelper"%>
<%
SiteConfig siteConfig = ConfigSystem.getConfigs();
List<Author> authors = (List<Author>) request.getAttribute("authors");
Map<String, AuthorQuestion> authorQuestions = (Map<String, AuthorQuestion>) request.getAttribute("authorQuestions");
AuthorQuestion aq = null;
MetaSeo metaseo = (MetaSeo) request.getAttribute("metaseo");

//Set content for Seo
Map<String, String> replates = new TreeMap<String, String>();
replates.put("__SERVER_NAME__", UrlHelper.getDomainServer(request));
replates.put("__SERVER_URL__", UrlHelper.getServerUrl(request));


String title = StringHelper.replateContent(metaseo.getTitle(), replates);
String description = StringHelper.replateContent(metaseo.getDescription(), replates);
String keywords = StringHelper.replateContent(metaseo.getKeywords(), replates);
String url = StringHelper.replateContent(metaseo.getOgurl(), replates);
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/templates/default/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

	<script type="text/javascript" src="/templates/<%=siteConfig.getTemplate() %>/js/users.js"></script>
		<div class="mainContent clearafter">
			<div class="leftMainContent">
				<!-- TAB -->
				<ul id="tab" class="clearafter">
					<li><a href="/authors">All Users</a></li>
					<li class="active"><a href="/lastest-user">Lastest User</a></li>
				</ul>
				<!-- END TAB -->
				
				<!-- Content Tab -->
				<div class="content">
					<div class="content_in">
						<ul class="user_listing">
							<% 
							for (Author author: authors) {
								aq = authorQuestions.get(author.getId());
							%>
							<li class="user_item">
								<img class="agent_photo left" width="100" height="100" src="<%=author.getAvatar() %>" name="user_photo">
								<h3 class="right">
									<span class="left"><a href="/author/<%=author.getAlias()%>-<%=author.getId()%>"><%=author.getName() %></a></span>
									<span class="total"><a href="/author/<%=author.getAlias()%>-<%=author.getId()%>#questions">Questions Asked  <b><%=aq != null ? aq.getqIds().size() : "0" %></b></a></span>
									<span class="total_point"><a href="/author/<%=author.getAlias()%>-<%=author.getId()%>#answers">Answers Provided <b><%=aq != null ? aq.getaIds().size() : "0" %></b></a></span>
								</h3>
								<p class="links right">                                               
									<span class="right profile">
										<a href="/author/<%=author.getAlias()%>-<%=author.getId()%>">View Profile »</a>
									</span>
								</p>
							</li>
							<% } %>
						</ul>
						
					</div>
				</div>
				<!-- End Content tab -->
			</div>
			<jsp:include page="/templates/default/elements/right.jsp" />
		</div>
<jsp:include page="/templates/default/layouts/footer.jsp" />